package edu.kjxy.day03.t7;

/**
 * 功能:
 * 作者:程序员欧阳子韩
 * 日期:2024/2/2 18:05
 */
public class Task {
    public synchronized void doLongTimeTask() {
        for (int i = 0; i < 100; i++) {
            System.out.println("noSynchronized threadName=" +
                    Thread.currentThread().getName() + " i=" + (i + 1));
        }
        System.out.println("");
        synchronized (this) {
            for (int i = 0; i < 100; i++) {
                System.out.println("Synchronized threadName=" +
                        Thread.currentThread().getName() + " i=" + (i + 1));
            }
        }
    }
}
